import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { SwaggerModuleOptions } from './swagger.options';

export const SWAGGER_MODULE_OPTIONS = 'SWAGGER_MODULE_OPTIONS';

export class CustomSwaggerModule {
    static setup(options: SwaggerModuleOptions) {
        const config = new DocumentBuilder().setTitle(options.title || 'swagger').build();
        const document = SwaggerModule.createDocument(options.app, config);
        SwaggerModule.setup(options.prefix || 'api-doc', options.app, document);
    }
}
